package com.example.demo.controller;

import com.example.demo.common.Result;
import com.example.demo.entity.EoExecuteTimetable;
import com.example.demo.mapper.ExecuteTimetableMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/timetable")
public class TimetableController extends BaseController{

    @Resource
    ExecuteTimetableMapper timetableMapper;

    @GetMapping("/list/{id}")
    public Result<?> list(@PathVariable Long id){
        List<EoExecuteTimetable> timetables = timetableMapper.selectAllById(id);
        return Result.success(timetables);
    }

    @PostMapping("/update")
    public Result<?> update(@RequestBody EoExecuteTimetable timetable){
        return Result.success(timetableMapper.updateById(timetable));
    }

    @DeleteMapping("/delete/{id}")
    public Result<?> delete(@PathVariable Long id){
        return Result.success(timetableMapper.deleteById(id));
    }
}
